﻿# ------------------ #
# XRDP Configuration #
# ------------------ #
param([string]$virtualMachineService, [string]$virtualMachineName)

Write-Information "Virtual machine '$virtualMachineName' executing XRDP '$($script.type)' configuration ... " -NoNewLine $true
switch ($script.type)
{
	"Xfce"
	{
        # Configure XFCE & XRDP
        Upload-SSHFile $subscription $virtualMachineService $virtualMachineName "$($Env:dp0)\Modules\VM\IC.Azure.XRDP.sh" "/home/$($subscription.virtualMachines.adminUserName)/"
        Execute-RemoteSSHScript $subscription $virtualMachineService $virtualMachineName "IC.Azure.XRDP.Xfce.sh" "XRDP (Xfce) configuration failed."
	}
	"Desktop"
	{
        # Configure Ubuntu Desktop & XRDP
        Upload-SSHFile $subscription $virtualMachineService $virtualMachineName "$($Env:dp0)\Modules\VM\IC.Azure.XRDP.sh" "/home/$($subscription.virtualMachines.adminUserName)/"
        Execute-RemoteSSHScript $subscription $virtualMachineService $virtualMachineName "IC.Azure.XRDP.Desktop.sh" "XRDP (Ubuntu Desktop) configuration failed."
	}
	default
	{
		throw "XRDP type '$($script.type)' is not supported."
	}
}
Write-Text "done."